from django.db import models

class Cate(models.Model):
    name=models.CharField(max_length=32,unique=True)

    class Meta:
        db_table='cate'


class Books(models.Model):
    book_name=models.CharField(max_length=32)
    img=models.ImageField(upload_to='img')
    cate=models.ForeignKey('Cate',on_delete=models.CASCADE)
    desc=models.CharField(max_length=1000)
    price=models.DecimalField(max_digits=9,decimal_places=2)

    class Meta:
        db_table='books'
